import 'package:flutter/material.dart';
import 'package:mybase/base/widget/layout/FFContainer.dart';

///超出即可上下滚动
class FFOverVerticalRollView extends StatefulWidget {
  Widget? child;

  ///约束最大的高，最小的高
  double minHeight;
  double maxHeight;

  ///宽
  double? width;

  Decoration? decoration;

  EdgeInsetsGeometry? margin;
  EdgeInsetsGeometry? padding;

  FFOverVerticalRollView({
    Key? key,
    this.child,
    required this.minHeight,
    required this.maxHeight,
    required this.width,
    this.decoration,
    this.margin,
    this.padding,
  }) : super(key: key);

  @override
  FFOverVerticalRollViewState createState() {
    return FFOverVerticalRollViewState();
  }
}

class FFOverVerticalRollViewState extends State<FFOverVerticalRollView> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return FFContainer(
      unconstrainedBox: true,
      width: widget.width,
      padding: widget.padding,
      margin: widget.margin,
      decoration: widget.decoration,
      constraints: BoxConstraints(
          minHeight: widget.minHeight, maxHeight: widget.maxHeight),
      child: SingleChildScrollView(
        child: widget.child,
      ),
    );
  }
}
